package com.yanqu.road.server.cmd.activity.relation;

import com.yanqu.road.entity.activity.UnionActivityConditionData;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.pb.cookboyactivity.CookBoyActivityProto;
import com.yanqu.road.pb.cross.activity.CrossActivityProto;
import com.yanqu.road.pb.crossunion.activity.CrossUnionActivityRankDataProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.activity.RelationActivityRankMgr;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.server.protocol.CrossProtocol;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_COOK_BOY_ACTIVITY_UNION_RANK, desc = "商会小当家类型活动积分排行榜")
public class RelationActivityUnionRankListCmd extends AbstractCommand {

    private int activityId;

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        CookBoyActivityProto.CookBoyActivityUnionRankListReqMsg reqMsg = CookBoyActivityProto.CookBoyActivityUnionRankListReqMsg.parseFrom(packet.getBytes());
        activityId = reqMsg.getActivityId();
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {

    }

    @Override
    public void sendData(GamePlayer player) {
      /*  String unionId = "";
        String localValue = "0";
        UnionActivityConditionData ucd = RelationActivityRankMgr.getUnionActivityConditionData(activityId, player.getUserId());
        if (null != ucd) {
            unionId = ucd.getUnionUid();
            localValue = ucd.getValue().toString();
        }
        CrossActivityProto.CrossUnionActivtyRankReqMsg.Builder req = CrossActivityProto.CrossUnionActivtyRankReqMsg.newBuilder();
        req.setActivtyId(activityId);
        req.setConditionType(0);
        req.setLocalValue(localValue);
        req.setUnionId(unionId);
        player.sendChannelPacket(CrossProtocol.C2_CROSS_GET_RELATION_ACTIVITY_UNION_RANK, req);*/
        CrossUnionActivityRankDataProto.CrossUnionActivityDataMsg.Builder msg = CrossUnionActivityRankDataProto.CrossUnionActivityDataMsg.newBuilder();
        msg.setActivityId(activityId);
        msg.setUserId(player.getUserId());
        msg.setConditionType(eGamePlayerEventType.CookBoy1IntegralUnionCrossRank.getValue());
        msg.setRankListType(4);
        player.sendPacket(CrossProtocol.C_CROSS_UNION_ACTIVITY_RANK_LIST, msg);

    }
}
